package cn.kgc.springcloud.controller;

import cn.kgc.springcloud.dto.StudentRequestDTO;
import cn.kgc.springcloud.dto.StudentResponseDTO;
import cn.kgc.springcloud.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: mosin
 * @version: v1.0  2022/6/15
 */
@RestController
@RequestMapping("students")
public class StudentController {

    @Autowired
    private StudentService studentService;

   @GetMapping()
    public List<StudentResponseDTO> test01(){
        return  studentService.getAll();
    }

    @PostMapping
    public  StudentResponseDTO test02(@RequestBody StudentRequestDTO studentRequestDTO){
        return  studentService.addStudent(studentRequestDTO);
    }

}
